package com.yf.zzmusic.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
  /**
   * 后端解决跨域
   * @param registry
   */
  @Override
  public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/*/**")
        .allowedHeaders("*")
        .allowedMethods("*")
        .maxAge(1800)
        .allowedOrigins("*");
  }
}
